package cn.xunjie.ymcc.service.impl;

import cn.xunjie.ymcc.domain.MessageSms;
import cn.xunjie.ymcc.mapper.MessageSmsMapper;
import cn.xunjie.ymcc.service.IMessageSmsService;
import cn.xunjie.ymcc.util.AssertUtil;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xue.jiao
 * @since 2022-07-15
 */
@Service
public class MessageSmsServiceImpl extends ServiceImpl<MessageSmsMapper, MessageSms> implements IMessageSmsService {
    @Autowired
    private MessageSmsMapper messageSmsMapper;

    @Override
    public void updateByType(MessageSms messageSms) {
        if(messageSms.getType()==1){
            messageSms.setType(0);
        }else {
            messageSms.setType(1);
        }
        messageSmsMapper.updateById(messageSms);

    }

    @Override
    public List<MessageSms> loadByPhone(String phone) {
        return messageSmsMapper.loadByPhone(phone);
    }
}
